---@class BuffEffect44101 : BaseBuffEffect
BuffEffect44101 = ClientFight.CreateClass("BuffEffect44101", ClientFight.BaseBuffEffect)
local t = BuffEffect44101

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local target = parameters[1];
    local owner = buff.target;
    local skill = parameters[2];
    local fightResult = parameters[3];
    local damageType = parameters[5];
    if (fightResult.state == DamageResultTypeEnum.HEAL.id) then
        return IBuffEffect.FAIL;
    end
    if (fightResult.damage <= 0) then
        return IBuffEffect.FAIL;
    end
    if (skill.skill.skillBean.f_HurtMethod ~= SkillDamageTypeEnum.PHYSICS.id and
            damageType ~= SkillDamageTypeEnum.PHYSICS.id) then
        return IBuffEffect.FAIL;
    end

    local addHp = fightResult.damage * buff.buffBean.f_BuffEffectValue[1] / Global.TEN_THOUSANDTH;
    local cureEffect = FighterAttributeManager.getFightAttr(owner, FighterAttributeEnum.CURE_EFFECT);
    if (cureEffect < -10000) then
        cureEffect = -10000;
    end
    local cureEffectAdd = addHp * cureEffect / 10000;

    addHp = addHp + cureEffectAdd;

    local maxHp = FighterAttributeManager.getFightAttr(owner, FighterAttributeEnum.HP);
    local maxAddHp = maxHp * buff.buffBean.f_BuffEffectValue[2] / Global.TEN_THOUSANDTH;
    if (addHp > maxAddHp) then
        addHp = maxAddHp;
    end

    if (maxHp - owner.hp < addHp) then
        addHp = maxHp - owner.hp;
        if (addHp < 0) then
            addHp = 0;
        end
    end
    if (addHp == 0) then
        return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);

    end
    local logAddHp = addHp;
    DamageManager.setFighterHp(fight, owner, owner, null, fightResult.state, addHp,
            owner.hp + addHp, true, false, true);
    --        buffManager.addBuff(fight, buff.skill, owner, owner, false, buff.buffBean.f_BuffEffectValue[2], buff.buffBean.f_BuffEffectValue[3]);
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
            .. buff.modelId .. " 触发更具伤害百分比回复HP效果，增加HP：" .. logAddHp .. " 触发技能id:" .. skill.skill.skillBean.f_SkillID);
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()